package org.railage.server.entities;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

/**
 * Ticket entity
 * 
 * @author Cyril Fertikov
 * 
 */
@Entity
@Table(name = "ticket")
public class Ticket implements Serializable {
	private static final long serialVersionUID = -6450216478977895468L;

	@Id
	@GeneratedValue
	@Column(name = "id")
	private int id;

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "user_id")
	private User user;

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "train_id")
	private Trip train;

	public Ticket() {

	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public User getPassenger() {
		return user;
	}

	public void setPassenger(User user) {
		this.user = user;
	}

	public Trip getTrain() {
		return train;
	}

	public void setTrain(Trip train) {
		this.train = train;
	}

}
